{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# MPG Cars\n",
    "\n",
    "Check out [Cars Exercises Video Tutorial](https://www.youtube.com/watch?v=avzLRBxoguU&list=PLgJhDSE2ZLxaY_DigHeiIDC1cD09rXgJv&index=3) to watch a data scientist go through the exercises"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Introduction:\n",
    "\n",
    "The following exercise utilizes data from [UC Irvine Machine Learning Repository](https://archive.ics.uci.edu/ml/datasets/Auto+MPG)\n",
    "\n",
    "### Step 1. Import the necessary libraries"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 2. Import the first dataset [cars1](https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/05_Merge/Auto_MPG/cars1.csv) and [cars2](https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/05_Merge/Auto_MPG/cars2.csv).  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "   ### Step 3. Assign each to a to a variable called cars1 and cars2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    mpg  cylinders  displacement horsepower  weight  acceleration  model  \\\n",
      "0  18.0          8           307        130    3504          12.0     70   \n",
      "1  15.0          8           350        165    3693          11.5     70   \n",
      "2  18.0          8           318        150    3436          11.0     70   \n",
      "3  16.0          8           304        150    3433          12.0     70   \n",
      "4  17.0          8           302        140    3449          10.5     70   \n",
      "\n",
      "   origin                        car  Unnamed: 9  Unnamed: 10  Unnamed: 11  \\\n",
      "0       1  chevrolet chevelle malibu         NaN          NaN          NaN   \n",
      "1       1          buick skylark 320         NaN          NaN          NaN   \n",
      "2       1         plymouth satellite         NaN          NaN          NaN   \n",
      "3       1              amc rebel sst         NaN          NaN          NaN   \n",
      "4       1                ford torino         NaN          NaN          NaN   \n",
      "\n",
      "   Unnamed: 12  Unnamed: 13  \n",
      "0          NaN          NaN  \n",
      "1          NaN          NaN  \n",
      "2          NaN          NaN  \n",
      "3          NaN          NaN  \n",
      "4          NaN          NaN  \n",
      "    mpg  cylinders  displacement horsepower  weight  acceleration  model  \\\n",
      "0  33.0          4            91         53    1795          17.4     76   \n",
      "1  20.0          6           225        100    3651          17.7     76   \n",
      "2  18.0          6           250         78    3574          21.0     76   \n",
      "3  18.5          6           250        110    3645          16.2     76   \n",
      "4  17.5          6           258         95    3193          17.8     76   \n",
      "\n",
      "   origin                 car  \n",
      "0       3         honda civic  \n",
      "1       1      dodge aspen se  \n",
      "2       1   ford granada ghia  \n",
      "3       1  pontiac ventura sj  \n",
      "4       1       amc pacer d/l  \n"
     ]
    }
   ],
   "source": [
    "cars1 = pd.read_csv(\"https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/05_Merge/Auto_MPG/cars1.csv\")\n",
    "cars2 = pd.read_csv(\"https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/05_Merge/Auto_MPG/cars2.csv\")\n",
    "\n",
    "print(cars1.head())\n",
    "print(cars2.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 4. Oops, it seems our first dataset has some unnamed blank columns, fix cars1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mpg</th>\n",
       "      <th>cylinders</th>\n",
       "      <th>displacement</th>\n",
       "      <th>horsepower</th>\n",
       "      <th>weight</th>\n",
       "      <th>acceleration</th>\n",
       "      <th>model</th>\n",
       "      <th>origin</th>\n",
       "      <th>car</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>18.0</td>\n",
       "      <td>8</td>\n",
       "      <td>307</td>\n",
       "      <td>130</td>\n",
       "      <td>3504</td>\n",
       "      <td>12.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>chevrolet chevelle malibu</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>15.0</td>\n",
       "      <td>8</td>\n",
       "      <td>350</td>\n",
       "      <td>165</td>\n",
       "      <td>3693</td>\n",
       "      <td>11.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>buick skylark 320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>18.0</td>\n",
       "      <td>8</td>\n",
       "      <td>318</td>\n",
       "      <td>150</td>\n",
       "      <td>3436</td>\n",
       "      <td>11.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>plymouth satellite</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>16.0</td>\n",
       "      <td>8</td>\n",
       "      <td>304</td>\n",
       "      <td>150</td>\n",
       "      <td>3433</td>\n",
       "      <td>12.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>amc rebel sst</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>17.0</td>\n",
       "      <td>8</td>\n",
       "      <td>302</td>\n",
       "      <td>140</td>\n",
       "      <td>3449</td>\n",
       "      <td>10.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>ford torino</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    mpg  cylinders  displacement horsepower  weight  acceleration  model  \\\n",
       "0  18.0          8           307        130    3504          12.0     70   \n",
       "1  15.0          8           350        165    3693          11.5     70   \n",
       "2  18.0          8           318        150    3436          11.0     70   \n",
       "3  16.0          8           304        150    3433          12.0     70   \n",
       "4  17.0          8           302        140    3449          10.5     70   \n",
       "\n",
       "   origin                        car  \n",
       "0       1  chevrolet chevelle malibu  \n",
       "1       1          buick skylark 320  \n",
       "2       1         plymouth satellite  \n",
       "3       1              amc rebel sst  \n",
       "4       1                ford torino  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cars1 = cars1.loc[:, \"mpg\":\"car\"]\n",
    "cars1.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 5. What is the number of observations in each dataset?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(198, 9)\n",
      "(200, 9)\n"
     ]
    }
   ],
   "source": [
    "print(cars1.shape)\n",
    "print(cars2.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 6. Join cars1 and cars2 into a single DataFrame called cars"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mpg</th>\n",
       "      <th>cylinders</th>\n",
       "      <th>displacement</th>\n",
       "      <th>horsepower</th>\n",
       "      <th>weight</th>\n",
       "      <th>acceleration</th>\n",
       "      <th>model</th>\n",
       "      <th>origin</th>\n",
       "      <th>car</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>18.0</td>\n",
       "      <td>8</td>\n",
       "      <td>307</td>\n",
       "      <td>130</td>\n",
       "      <td>3504</td>\n",
       "      <td>12.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>chevrolet chevelle malibu</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>15.0</td>\n",
       "      <td>8</td>\n",
       "      <td>350</td>\n",
       "      <td>165</td>\n",
       "      <td>3693</td>\n",
       "      <td>11.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>buick skylark 320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>18.0</td>\n",
       "      <td>8</td>\n",
       "      <td>318</td>\n",
       "      <td>150</td>\n",
       "      <td>3436</td>\n",
       "      <td>11.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>plymouth satellite</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>16.0</td>\n",
       "      <td>8</td>\n",
       "      <td>304</td>\n",
       "      <td>150</td>\n",
       "      <td>3433</td>\n",
       "      <td>12.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>amc rebel sst</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>17.0</td>\n",
       "      <td>8</td>\n",
       "      <td>302</td>\n",
       "      <td>140</td>\n",
       "      <td>3449</td>\n",
       "      <td>10.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>ford torino</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>15.0</td>\n",
       "      <td>8</td>\n",
       "      <td>429</td>\n",
       "      <td>198</td>\n",
       "      <td>4341</td>\n",
       "      <td>10.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>ford galaxie 500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>14.0</td>\n",
       "      <td>8</td>\n",
       "      <td>454</td>\n",
       "      <td>220</td>\n",
       "      <td>4354</td>\n",
       "      <td>9.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>chevrolet impala</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>14.0</td>\n",
       "      <td>8</td>\n",
       "      <td>440</td>\n",
       "      <td>215</td>\n",
       "      <td>4312</td>\n",
       "      <td>8.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>plymouth fury iii</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>14.0</td>\n",
       "      <td>8</td>\n",
       "      <td>455</td>\n",
       "      <td>225</td>\n",
       "      <td>4425</td>\n",
       "      <td>10.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>pontiac catalina</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>15.0</td>\n",
       "      <td>8</td>\n",
       "      <td>390</td>\n",
       "      <td>190</td>\n",
       "      <td>3850</td>\n",
       "      <td>8.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>amc ambassador dpl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>15.0</td>\n",
       "      <td>8</td>\n",
       "      <td>383</td>\n",
       "      <td>170</td>\n",
       "      <td>3563</td>\n",
       "      <td>10.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>dodge challenger se</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>14.0</td>\n",
       "      <td>8</td>\n",
       "      <td>340</td>\n",
       "      <td>160</td>\n",
       "      <td>3609</td>\n",
       "      <td>8.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>plymouth 'cuda 340</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>15.0</td>\n",
       "      <td>8</td>\n",
       "      <td>400</td>\n",
       "      <td>150</td>\n",
       "      <td>3761</td>\n",
       "      <td>9.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>chevrolet monte carlo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>14.0</td>\n",
       "      <td>8</td>\n",
       "      <td>455</td>\n",
       "      <td>225</td>\n",
       "      <td>3086</td>\n",
       "      <td>10.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>buick estate wagon (sw)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>24.0</td>\n",
       "      <td>4</td>\n",
       "      <td>113</td>\n",
       "      <td>95</td>\n",
       "      <td>2372</td>\n",
       "      <td>15.0</td>\n",
       "      <td>70</td>\n",
       "      <td>3</td>\n",
       "      <td>toyota corona mark ii</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>22.0</td>\n",
       "      <td>6</td>\n",
       "      <td>198</td>\n",
       "      <td>95</td>\n",
       "      <td>2833</td>\n",
       "      <td>15.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>plymouth duster</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>18.0</td>\n",
       "      <td>6</td>\n",
       "      <td>199</td>\n",
       "      <td>97</td>\n",
       "      <td>2774</td>\n",
       "      <td>15.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>amc hornet</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>21.0</td>\n",
       "      <td>6</td>\n",
       "      <td>200</td>\n",
       "      <td>85</td>\n",
       "      <td>2587</td>\n",
       "      <td>16.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>ford maverick</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>27.0</td>\n",
       "      <td>4</td>\n",
       "      <td>97</td>\n",
       "      <td>88</td>\n",
       "      <td>2130</td>\n",
       "      <td>14.5</td>\n",
       "      <td>70</td>\n",
       "      <td>3</td>\n",
       "      <td>datsun pl510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>26.0</td>\n",
       "      <td>4</td>\n",
       "      <td>97</td>\n",
       "      <td>46</td>\n",
       "      <td>1835</td>\n",
       "      <td>20.5</td>\n",
       "      <td>70</td>\n",
       "      <td>2</td>\n",
       "      <td>volkswagen 1131 deluxe sedan</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>25.0</td>\n",
       "      <td>4</td>\n",
       "      <td>110</td>\n",
       "      <td>87</td>\n",
       "      <td>2672</td>\n",
       "      <td>17.5</td>\n",
       "      <td>70</td>\n",
       "      <td>2</td>\n",
       "      <td>peugeot 504</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>24.0</td>\n",
       "      <td>4</td>\n",
       "      <td>107</td>\n",
       "      <td>90</td>\n",
       "      <td>2430</td>\n",
       "      <td>14.5</td>\n",
       "      <td>70</td>\n",
       "      <td>2</td>\n",
       "      <td>audi 100 ls</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>25.0</td>\n",
       "      <td>4</td>\n",
       "      <td>104</td>\n",
       "      <td>95</td>\n",
       "      <td>2375</td>\n",
       "      <td>17.5</td>\n",
       "      <td>70</td>\n",
       "      <td>2</td>\n",
       "      <td>saab 99e</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>26.0</td>\n",
       "      <td>4</td>\n",
       "      <td>121</td>\n",
       "      <td>113</td>\n",
       "      <td>2234</td>\n",
       "      <td>12.5</td>\n",
       "      <td>70</td>\n",
       "      <td>2</td>\n",
       "      <td>bmw 2002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>21.0</td>\n",
       "      <td>6</td>\n",
       "      <td>199</td>\n",
       "      <td>90</td>\n",
       "      <td>2648</td>\n",
       "      <td>15.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>amc gremlin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>10.0</td>\n",
       "      <td>8</td>\n",
       "      <td>360</td>\n",
       "      <td>215</td>\n",
       "      <td>4615</td>\n",
       "      <td>14.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>ford f250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>10.0</td>\n",
       "      <td>8</td>\n",
       "      <td>307</td>\n",
       "      <td>200</td>\n",
       "      <td>4376</td>\n",
       "      <td>15.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>chevy c20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>11.0</td>\n",
       "      <td>8</td>\n",
       "      <td>318</td>\n",
       "      <td>210</td>\n",
       "      <td>4382</td>\n",
       "      <td>13.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>dodge d200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>9.0</td>\n",
       "      <td>8</td>\n",
       "      <td>304</td>\n",
       "      <td>193</td>\n",
       "      <td>4732</td>\n",
       "      <td>18.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>hi 1200d</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>27.0</td>\n",
       "      <td>4</td>\n",
       "      <td>97</td>\n",
       "      <td>88</td>\n",
       "      <td>2130</td>\n",
       "      <td>14.5</td>\n",
       "      <td>71</td>\n",
       "      <td>3</td>\n",
       "      <td>datsun pl510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>170</th>\n",
       "      <td>27.0</td>\n",
       "      <td>4</td>\n",
       "      <td>112</td>\n",
       "      <td>88</td>\n",
       "      <td>2640</td>\n",
       "      <td>18.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>chevrolet cavalier wagon</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>34.0</td>\n",
       "      <td>4</td>\n",
       "      <td>112</td>\n",
       "      <td>88</td>\n",
       "      <td>2395</td>\n",
       "      <td>18.0</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>chevrolet cavalier 2-door</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>172</th>\n",
       "      <td>31.0</td>\n",
       "      <td>4</td>\n",
       "      <td>112</td>\n",
       "      <td>85</td>\n",
       "      <td>2575</td>\n",
       "      <td>16.2</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>pontiac j2000 se hatchback</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>173</th>\n",
       "      <td>29.0</td>\n",
       "      <td>4</td>\n",
       "      <td>135</td>\n",
       "      <td>84</td>\n",
       "      <td>2525</td>\n",
       "      <td>16.0</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>dodge aries se</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>174</th>\n",
       "      <td>27.0</td>\n",
       "      <td>4</td>\n",
       "      <td>151</td>\n",
       "      <td>90</td>\n",
       "      <td>2735</td>\n",
       "      <td>18.0</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>pontiac phoenix</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>175</th>\n",
       "      <td>24.0</td>\n",
       "      <td>4</td>\n",
       "      <td>140</td>\n",
       "      <td>92</td>\n",
       "      <td>2865</td>\n",
       "      <td>16.4</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>ford fairmont futura</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>23.0</td>\n",
       "      <td>4</td>\n",
       "      <td>151</td>\n",
       "      <td>?</td>\n",
       "      <td>3035</td>\n",
       "      <td>20.5</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>amc concord dl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>36.0</td>\n",
       "      <td>4</td>\n",
       "      <td>105</td>\n",
       "      <td>74</td>\n",
       "      <td>1980</td>\n",
       "      <td>15.3</td>\n",
       "      <td>82</td>\n",
       "      <td>2</td>\n",
       "      <td>volkswagen rabbit l</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>178</th>\n",
       "      <td>37.0</td>\n",
       "      <td>4</td>\n",
       "      <td>91</td>\n",
       "      <td>68</td>\n",
       "      <td>2025</td>\n",
       "      <td>18.2</td>\n",
       "      <td>82</td>\n",
       "      <td>3</td>\n",
       "      <td>mazda glc custom l</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>179</th>\n",
       "      <td>31.0</td>\n",
       "      <td>4</td>\n",
       "      <td>91</td>\n",
       "      <td>68</td>\n",
       "      <td>1970</td>\n",
       "      <td>17.6</td>\n",
       "      <td>82</td>\n",
       "      <td>3</td>\n",
       "      <td>mazda glc custom</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>180</th>\n",
       "      <td>38.0</td>\n",
       "      <td>4</td>\n",
       "      <td>105</td>\n",
       "      <td>63</td>\n",
       "      <td>2125</td>\n",
       "      <td>14.7</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>plymouth horizon miser</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>181</th>\n",
       "      <td>36.0</td>\n",
       "      <td>4</td>\n",
       "      <td>98</td>\n",
       "      <td>70</td>\n",
       "      <td>2125</td>\n",
       "      <td>17.3</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>mercury lynx l</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>182</th>\n",
       "      <td>36.0</td>\n",
       "      <td>4</td>\n",
       "      <td>120</td>\n",
       "      <td>88</td>\n",
       "      <td>2160</td>\n",
       "      <td>14.5</td>\n",
       "      <td>82</td>\n",
       "      <td>3</td>\n",
       "      <td>nissan stanza xe</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>183</th>\n",
       "      <td>36.0</td>\n",
       "      <td>4</td>\n",
       "      <td>107</td>\n",
       "      <td>75</td>\n",
       "      <td>2205</td>\n",
       "      <td>14.5</td>\n",
       "      <td>82</td>\n",
       "      <td>3</td>\n",
       "      <td>honda accord</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>184</th>\n",
       "      <td>34.0</td>\n",
       "      <td>4</td>\n",
       "      <td>108</td>\n",
       "      <td>70</td>\n",
       "      <td>2245</td>\n",
       "      <td>16.9</td>\n",
       "      <td>82</td>\n",
       "      <td>3</td>\n",
       "      <td>toyota corolla</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>185</th>\n",
       "      <td>38.0</td>\n",
       "      <td>4</td>\n",
       "      <td>91</td>\n",
       "      <td>67</td>\n",
       "      <td>1965</td>\n",
       "      <td>15.0</td>\n",
       "      <td>82</td>\n",
       "      <td>3</td>\n",
       "      <td>honda civic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>186</th>\n",
       "      <td>32.0</td>\n",
       "      <td>4</td>\n",
       "      <td>91</td>\n",
       "      <td>67</td>\n",
       "      <td>1965</td>\n",
       "      <td>15.7</td>\n",
       "      <td>82</td>\n",
       "      <td>3</td>\n",
       "      <td>honda civic (auto)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>187</th>\n",
       "      <td>38.0</td>\n",
       "      <td>4</td>\n",
       "      <td>91</td>\n",
       "      <td>67</td>\n",
       "      <td>1995</td>\n",
       "      <td>16.2</td>\n",
       "      <td>82</td>\n",
       "      <td>3</td>\n",
       "      <td>datsun 310 gx</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>188</th>\n",
       "      <td>25.0</td>\n",
       "      <td>6</td>\n",
       "      <td>181</td>\n",
       "      <td>110</td>\n",
       "      <td>2945</td>\n",
       "      <td>16.4</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>buick century limited</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>189</th>\n",
       "      <td>38.0</td>\n",
       "      <td>6</td>\n",
       "      <td>262</td>\n",
       "      <td>85</td>\n",
       "      <td>3015</td>\n",
       "      <td>17.0</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>oldsmobile cutlass ciera (diesel)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>190</th>\n",
       "      <td>26.0</td>\n",
       "      <td>4</td>\n",
       "      <td>156</td>\n",
       "      <td>92</td>\n",
       "      <td>2585</td>\n",
       "      <td>14.5</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>chrysler lebaron medallion</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>191</th>\n",
       "      <td>22.0</td>\n",
       "      <td>6</td>\n",
       "      <td>232</td>\n",
       "      <td>112</td>\n",
       "      <td>2835</td>\n",
       "      <td>14.7</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>ford granada l</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>192</th>\n",
       "      <td>32.0</td>\n",
       "      <td>4</td>\n",
       "      <td>144</td>\n",
       "      <td>96</td>\n",
       "      <td>2665</td>\n",
       "      <td>13.9</td>\n",
       "      <td>82</td>\n",
       "      <td>3</td>\n",
       "      <td>toyota celica gt</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>193</th>\n",
       "      <td>36.0</td>\n",
       "      <td>4</td>\n",
       "      <td>135</td>\n",
       "      <td>84</td>\n",
       "      <td>2370</td>\n",
       "      <td>13.0</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>dodge charger 2.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>194</th>\n",
       "      <td>27.0</td>\n",
       "      <td>4</td>\n",
       "      <td>151</td>\n",
       "      <td>90</td>\n",
       "      <td>2950</td>\n",
       "      <td>17.3</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>chevrolet camaro</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>27.0</td>\n",
       "      <td>4</td>\n",
       "      <td>140</td>\n",
       "      <td>86</td>\n",
       "      <td>2790</td>\n",
       "      <td>15.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>ford mustang gl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>44.0</td>\n",
       "      <td>4</td>\n",
       "      <td>97</td>\n",
       "      <td>52</td>\n",
       "      <td>2130</td>\n",
       "      <td>24.6</td>\n",
       "      <td>82</td>\n",
       "      <td>2</td>\n",
       "      <td>vw pickup</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>32.0</td>\n",
       "      <td>4</td>\n",
       "      <td>135</td>\n",
       "      <td>84</td>\n",
       "      <td>2295</td>\n",
       "      <td>11.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>dodge rampage</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>28.0</td>\n",
       "      <td>4</td>\n",
       "      <td>120</td>\n",
       "      <td>79</td>\n",
       "      <td>2625</td>\n",
       "      <td>18.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>ford ranger</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>31.0</td>\n",
       "      <td>4</td>\n",
       "      <td>119</td>\n",
       "      <td>82</td>\n",
       "      <td>2720</td>\n",
       "      <td>19.4</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>chevy s-10</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>398 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      mpg  cylinders  displacement horsepower  weight  acceleration  model  \\\n",
       "0    18.0          8           307        130    3504          12.0     70   \n",
       "1    15.0          8           350        165    3693          11.5     70   \n",
       "2    18.0          8           318        150    3436          11.0     70   \n",
       "3    16.0          8           304        150    3433          12.0     70   \n",
       "4    17.0          8           302        140    3449          10.5     70   \n",
       "5    15.0          8           429        198    4341          10.0     70   \n",
       "6    14.0          8           454        220    4354           9.0     70   \n",
       "7    14.0          8           440        215    4312           8.5     70   \n",
       "8    14.0          8           455        225    4425          10.0     70   \n",
       "9    15.0          8           390        190    3850           8.5     70   \n",
       "10   15.0          8           383        170    3563          10.0     70   \n",
       "11   14.0          8           340        160    3609           8.0     70   \n",
       "12   15.0          8           400        150    3761           9.5     70   \n",
       "13   14.0          8           455        225    3086          10.0     70   \n",
       "14   24.0          4           113         95    2372          15.0     70   \n",
       "15   22.0          6           198         95    2833          15.5     70   \n",
       "16   18.0          6           199         97    2774          15.5     70   \n",
       "17   21.0          6           200         85    2587          16.0     70   \n",
       "18   27.0          4            97         88    2130          14.5     70   \n",
       "19   26.0          4            97         46    1835          20.5     70   \n",
       "20   25.0          4           110         87    2672          17.5     70   \n",
       "21   24.0          4           107         90    2430          14.5     70   \n",
       "22   25.0          4           104         95    2375          17.5     70   \n",
       "23   26.0          4           121        113    2234          12.5     70   \n",
       "24   21.0          6           199         90    2648          15.0     70   \n",
       "25   10.0          8           360        215    4615          14.0     70   \n",
       "26   10.0          8           307        200    4376          15.0     70   \n",
       "27   11.0          8           318        210    4382          13.5     70   \n",
       "28    9.0          8           304        193    4732          18.5     70   \n",
       "29   27.0          4            97         88    2130          14.5     71   \n",
       "..    ...        ...           ...        ...     ...           ...    ...   \n",
       "170  27.0          4           112         88    2640          18.6     82   \n",
       "171  34.0          4           112         88    2395          18.0     82   \n",
       "172  31.0          4           112         85    2575          16.2     82   \n",
       "173  29.0          4           135         84    2525          16.0     82   \n",
       "174  27.0          4           151         90    2735          18.0     82   \n",
       "175  24.0          4           140         92    2865          16.4     82   \n",
       "176  23.0          4           151          ?    3035          20.5     82   \n",
       "177  36.0          4           105         74    1980          15.3     82   \n",
       "178  37.0          4            91         68    2025          18.2     82   \n",
       "179  31.0          4            91         68    1970          17.6     82   \n",
       "180  38.0          4           105         63    2125          14.7     82   \n",
       "181  36.0          4            98         70    2125          17.3     82   \n",
       "182  36.0          4           120         88    2160          14.5     82   \n",
       "183  36.0          4           107         75    2205          14.5     82   \n",
       "184  34.0          4           108         70    2245          16.9     82   \n",
       "185  38.0          4            91         67    1965          15.0     82   \n",
       "186  32.0          4            91         67    1965          15.7     82   \n",
       "187  38.0          4            91         67    1995          16.2     82   \n",
       "188  25.0          6           181        110    2945          16.4     82   \n",
       "189  38.0          6           262         85    3015          17.0     82   \n",
       "190  26.0          4           156         92    2585          14.5     82   \n",
       "191  22.0          6           232        112    2835          14.7     82   \n",
       "192  32.0          4           144         96    2665          13.9     82   \n",
       "193  36.0          4           135         84    2370          13.0     82   \n",
       "194  27.0          4           151         90    2950          17.3     82   \n",
       "195  27.0          4           140         86    2790          15.6     82   \n",
       "196  44.0          4            97         52    2130          24.6     82   \n",
       "197  32.0          4           135         84    2295          11.6     82   \n",
       "198  28.0          4           120         79    2625          18.6     82   \n",
       "199  31.0          4           119         82    2720          19.4     82   \n",
       "\n",
       "     origin                                car  \n",
       "0         1          chevrolet chevelle malibu  \n",
       "1         1                  buick skylark 320  \n",
       "2         1                 plymouth satellite  \n",
       "3         1                      amc rebel sst  \n",
       "4         1                        ford torino  \n",
       "5         1                   ford galaxie 500  \n",
       "6         1                   chevrolet impala  \n",
       "7         1                  plymouth fury iii  \n",
       "8         1                   pontiac catalina  \n",
       "9         1                 amc ambassador dpl  \n",
       "10        1                dodge challenger se  \n",
       "11        1                 plymouth 'cuda 340  \n",
       "12        1              chevrolet monte carlo  \n",
       "13        1            buick estate wagon (sw)  \n",
       "14        3              toyota corona mark ii  \n",
       "15        1                    plymouth duster  \n",
       "16        1                         amc hornet  \n",
       "17        1                      ford maverick  \n",
       "18        3                       datsun pl510  \n",
       "19        2       volkswagen 1131 deluxe sedan  \n",
       "20        2                        peugeot 504  \n",
       "21        2                        audi 100 ls  \n",
       "22        2                           saab 99e  \n",
       "23        2                           bmw 2002  \n",
       "24        1                        amc gremlin  \n",
       "25        1                          ford f250  \n",
       "26        1                          chevy c20  \n",
       "27        1                         dodge d200  \n",
       "28        1                           hi 1200d  \n",
       "29        3                       datsun pl510  \n",
       "..      ...                                ...  \n",
       "170       1           chevrolet cavalier wagon  \n",
       "171       1          chevrolet cavalier 2-door  \n",
       "172       1         pontiac j2000 se hatchback  \n",
       "173       1                     dodge aries se  \n",
       "174       1                    pontiac phoenix  \n",
       "175       1               ford fairmont futura  \n",
       "176       1                     amc concord dl  \n",
       "177       2                volkswagen rabbit l  \n",
       "178       3                 mazda glc custom l  \n",
       "179       3                   mazda glc custom  \n",
       "180       1             plymouth horizon miser  \n",
       "181       1                     mercury lynx l  \n",
       "182       3                   nissan stanza xe  \n",
       "183       3                       honda accord  \n",
       "184       3                     toyota corolla  \n",
       "185       3                        honda civic  \n",
       "186       3                 honda civic (auto)  \n",
       "187       3                      datsun 310 gx  \n",
       "188       1              buick century limited  \n",
       "189       1  oldsmobile cutlass ciera (diesel)  \n",
       "190       1         chrysler lebaron medallion  \n",
       "191       1                     ford granada l  \n",
       "192       3                   toyota celica gt  \n",
       "193       1                  dodge charger 2.2  \n",
       "194       1                   chevrolet camaro  \n",
       "195       1                    ford mustang gl  \n",
       "196       2                          vw pickup  \n",
       "197       1                      dodge rampage  \n",
       "198       1                        ford ranger  \n",
       "199       1                         chevy s-10  \n",
       "\n",
       "[398 rows x 9 columns]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cars = cars1.append(cars2)\n",
    "cars"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 7. Oops, there is a column missing, called owners. Create a random number Series from 15,000 to 73,000."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([29487, 25680, 65268, 31827, 69215, 72602, 52693, 58440, 16183,\n",
       "       45014, 32318, 72942, 62163, 35951, 57625, 59355, 36533, 67048,\n",
       "       58159, 69743, 25146, 22755, 44966, 46792, 56553, 65013, 55908,\n",
       "       69563, 22030, 59561, 15593, 52998, 54795, 16169, 24809, 35580,\n",
       "       46590, 38792, 43099, 37166, 21390, 56496, 68606, 21110, 56334,\n",
       "       45477, 51961, 27625, 51176, 30796, 61809, 65450, 67375, 23342,\n",
       "       27499, 50585, 57302, 56191, 60281, 32865, 58605, 66374, 15315,\n",
       "       31791, 28670, 38796, 69214, 41055, 32353, 31574, 65799, 42998,\n",
       "       72785, 18415, 31977, 29812, 65439, 21161, 60871, 67151, 22179,\n",
       "       32821, 55392, 34586, 67937, 31646, 66397, 35258, 63815, 71291,\n",
       "       51130, 27684, 49648, 52691, 50681, 68185, 32635, 51553, 28970,\n",
       "       19112, 26035, 67666, 55471, 51477, 62055, 53003, 41265, 18565,\n",
       "       48851, 48673, 45832, 67891, 57638, 29240, 41236, 16950, 31449,\n",
       "       50528, 22397, 15876, 26414, 16736, 23896, 46104, 17583, 65951,\n",
       "       38538, 31443, 19299, 46095, 31239, 19290, 38051, 68575, 61755,\n",
       "       22560, 34460, 35395, 34608, 56906, 44895, 48429, 20900, 49770,\n",
       "       50513, 59402, 26893, 37233, 19036, 20523, 18765, 46333, 42831,\n",
       "       53698, 25218, 63106, 16928, 34901, 43674, 65453, 54428, 68502,\n",
       "       19043, 20325, 45039, 29466, 49672, 67972, 30547, 22522, 69354,\n",
       "       40489, 72887, 15724, 51442, 65182, 64555, 42138, 72988, 20861,\n",
       "       67898, 20768, 36415, 47480, 16820, 48739, 62610, 43473, 23002,\n",
       "       43488, 62581, 37724, 63019, 44912, 35595, 59188, 51814, 65283,\n",
       "       53479, 27660, 38237, 22957, 47870, 15533, 41944, 51830, 56676,\n",
       "       57481, 48529, 72220, 66675, 50099, 30585, 25436, 49195, 26050,\n",
       "       24899, 37213, 25870, 67447, 23808, 71275, 67572, 18545, 43553,\n",
       "       54858, 23077, 33705, 31282, 26298, 23742, 36110, 51491, 18019,\n",
       "       60655, 27453, 35563, 63627, 35315, 56717, 59281, 55634, 18415,\n",
       "       59570, 47320, 20110, 18425, 19352, 18032, 31816, 28573, 66030,\n",
       "       54723, 21592, 37160, 59518, 35629, 47619, 52359, 34566, 64932,\n",
       "       24072, 39445, 31203, 63975, 62041, 70175, 51029, 32058, 19428,\n",
       "       65553, 50799, 48190, 68061, 68201, 53389, 15901, 44585, 54723,\n",
       "       30446, 63716, 57488, 67134, 22033, 53694, 40002, 24854, 59747,\n",
       "       59827, 53378, 53196, 68686, 20784, 28181, 33044, 41694, 39857,\n",
       "       57296, 69021, 17359, 29794, 22515, 55877, 22806, 50027, 56787,\n",
       "       50844, 17420, 65259, 19141, 40204, 19530, 30116, 34973, 15641,\n",
       "       53492, 59574, 59082, 64400, 70163, 43058, 69696, 67996, 26158,\n",
       "       32936, 45461, 47390, 32368, 15400, 40895, 16572, 31776, 62121,\n",
       "       56704, 39335, 27716, 52565, 50831, 45049, 25173, 25018, 18606,\n",
       "       71177, 66288, 46754, 68175, 35829, 24959, 54792, 19059, 29092,\n",
       "       58736, 62938, 44733, 17884, 33905, 33965, 24641, 52257, 28178,\n",
       "       29515, 37703, 56036, 51556, 23590, 61888, 70224, 53730, 41328,\n",
       "       16501, 30360, 54106, 29101, 35631, 56173, 30424, 46887, 23657,\n",
       "       17723, 71709, 45270, 30380, 27779, 33774, 36379, 47127, 63625,\n",
       "       16750, 65740, 53802, 40995, 37487, 42791, 21825, 69344, 63210,\n",
       "       15982, 20259])"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nr_owners = np.random.randint(15000, high=73001, size=398, dtype='l')\n",
    "nr_owners"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 8. Add the column owners to cars"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mpg</th>\n",
       "      <th>cylinders</th>\n",
       "      <th>displacement</th>\n",
       "      <th>horsepower</th>\n",
       "      <th>weight</th>\n",
       "      <th>acceleration</th>\n",
       "      <th>model</th>\n",
       "      <th>origin</th>\n",
       "      <th>car</th>\n",
       "      <th>owners</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>27.0</td>\n",
       "      <td>4</td>\n",
       "      <td>140</td>\n",
       "      <td>86</td>\n",
       "      <td>2790</td>\n",
       "      <td>15.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>ford mustang gl</td>\n",
       "      <td>21825</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>44.0</td>\n",
       "      <td>4</td>\n",
       "      <td>97</td>\n",
       "      <td>52</td>\n",
       "      <td>2130</td>\n",
       "      <td>24.6</td>\n",
       "      <td>82</td>\n",
       "      <td>2</td>\n",
       "      <td>vw pickup</td>\n",
       "      <td>69344</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>32.0</td>\n",
       "      <td>4</td>\n",
       "      <td>135</td>\n",
       "      <td>84</td>\n",
       "      <td>2295</td>\n",
       "      <td>11.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>dodge rampage</td>\n",
       "      <td>63210</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>28.0</td>\n",
       "      <td>4</td>\n",
       "      <td>120</td>\n",
       "      <td>79</td>\n",
       "      <td>2625</td>\n",
       "      <td>18.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>ford ranger</td>\n",
       "      <td>15982</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>31.0</td>\n",
       "      <td>4</td>\n",
       "      <td>119</td>\n",
       "      <td>82</td>\n",
       "      <td>2720</td>\n",
       "      <td>19.4</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>chevy s-10</td>\n",
       "      <td>20259</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      mpg  cylinders  displacement horsepower  weight  acceleration  model  \\\n",
       "195  27.0          4           140         86    2790          15.6     82   \n",
       "196  44.0          4            97         52    2130          24.6     82   \n",
       "197  32.0          4           135         84    2295          11.6     82   \n",
       "198  28.0          4           120         79    2625          18.6     82   \n",
       "199  31.0          4           119         82    2720          19.4     82   \n",
       "\n",
       "     origin              car  owners  \n",
       "195       1  ford mustang gl   21825  \n",
       "196       2        vw pickup   69344  \n",
       "197       1    dodge rampage   63210  \n",
       "198       1      ford ranger   15982  \n",
       "199       1       chevy s-10   20259  "
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cars['owners'] = nr_owners\n",
    "cars.tail()"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
